var viewer;
var image_layers_index = [];
var scene_layers_index = [];
var all_layers = [];



function onload(Cesium) {
    viewer = new Cesium.Viewer('cesiumContainer', {
        infobox: true,
        timeline: false,
        orderIndependentTranslucency: false,
        contextOptions: {
            msaaLevel: 4,
            requestWebgl2: true
        },
    });
}

function findImgLayer(url){
    var layer = "";
    for(var i = 0;i<viewer.imageryLayers._layers.length;i++){
        var imgLayer = viewer.imageryLayers._layers[i];
        if(imgLayer.imageryProvider.tablename && imgLayer.imageryProvider.tablename.indexOf(url)>-1){
            layer = viewer.imageryLayers.get(i);
            break;
        }
    }
    return layer;
}

function findImgLayerByName(name){
    var layer = "";
    for(var i = 0;i<viewer.imageryLayers._layers.length;i++){
        var imgLayer = viewer.imageryLayers._layers[i];
        if(imgLayer.imageryProvider.name && imgLayer.imageryProvider.name.indexOf(name)>-1){
            layer = viewer.imageryLayers.get(i);
            break;
        }
    }
    return layer;
}

function findSceneLayer(name){
    var index= scene_layers_index.map(item => item.name).indexOf(name);
    var layer = scene.layers.findByIndex(index);
    return layer;
}

function findImageLayer(name){
    var index= image_layers_index.map(item => item.name).indexOf(name);
    var layer = viewer.imageryLayers.get(idx+1);
    return layer;
}

// 添加在线图层方法


// 移除在线图层方法


// 添加自定义图层方法

// 移除自定义图层方法
